package com.suray.attendance.common.utils;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

/**
 * Description: 字符串转化为JSON数据字符串
 * Author: linyu
 * Date: 2023/10/10
 */
public class StringToJsonArray {
    public static String getJsonArray(String s){
        List<String> appList = new ArrayList<>();
        appList.add(s);

        // 构造JSON数组
        JSONArray jsonArray = new JSONArray();
        for (String app : appList) {
            jsonArray.put(app);
        }

        // 输出JSON数组字符串
        String output = jsonArray.toString();

        System.out.println("Converted output: " + output);
        return output;
    }

}
